import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import requireTransform from 'vite-plugin-require-transform';
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    requireTransform({
      fileRegex: /.ts$|.vue$/
    }),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
],
  define: {
    'process.env': {},
  },
  resolve: {
    // 配置路径别名
    alias: {
      '@': resolve(__dirname, './src'),
    },
  },
//   server: {
//     proxy: {
//         '/api': {
//             target: baseURL,  //请求对象
//             ws: true,//代理websocked
//             changeOrigin: true,
//             secure: false, //target是否为https接口
//             rewrite:{
//               '^/api': ''  //更改请求URL
//           },
//           //   pathRewrite: {
//           //     '^/api': ''  //更改请求URL
//           // }
//         }
//     }
// }
})
